<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%-- 引入页面头 --%>
<%@ include file="/pageHead.jsp"%>

<form name="form1" id="form1" action="" method="post">
	<div class="pageMain">
		<div class="pageTitle"><%=MessageResourcesUtils.getMessage(request, "systemmanage.bascsetting.title")%><span></span><%=MessageResourcesUtils.getMessage(request, "dailyoperation.menuauthoritymanage.title") %><span></span><%=MessageResourcesUtils.getMessage(request, "dailyoperation.menuauthoritymanage.update") %></div>
		<div class="pageBody">
			<div class="form-group">
				<ul>
					<li>
						<i>*</i>
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.menuauthoritymanage.type") %></label>
						<span><select id="type" name="type"></select></span>
					</li>
					</li>
					<li id="li_hidden">
						<i>*</i>
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.menuauthoritymanage.menuname") %></label>
						<span><input type="text" id="menuname" name="menuname" value="${menuAuthorityManage.menuname}" class="validate[required,maxSize[50]]" /></span>
						<input type="hidden" id="menuid" name="menuid" value="${menuAuthorityManage.menuid}"/>
						<input type="hidden" id="id" name="id" value="${menuAuthorityManage.id}"/>
					</li>
				</ul>
				<ul>
					<li>
						<i>*</i>
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.menuauthoritymanage.url") %></label>
						<span><input type="text" id="url" name="url" style="width: 330px" value="${menuAuthorityManage.url}" class="validate[required,maxSize[100]]"/></span>
					</li>
				</ul>
			</div>			
		</div>
		<div class="button-group">
       			<input type="button" class="btn btn-default"  id="butSave" name="butSave" value='<%=MessageResourcesUtils.getMessage(request, "common.button.save") %>' />
       			<input type="button" class="btn btn-default"  id="butReturn" name="butReturn" value='<%=MessageResourcesUtils.getMessage(request, "common.button.back") %>' />
		</div>
	</div>
</form>

<script type="text/javascript">	
$(document).ready(function() {
	$("#type").selectutil({
		optModel : <%=SysConstant.RequestMenuType.getMode1JSONString(false,true)%>,
		optDefault : ''
	});
	
	$("#type").val('${menuAuthorityManage.type}');
	//下拉列表框绑定数据是判断是什么数据，然后进行隐藏操作
	var value = $('#type').val();
	hidden(value);
	
	$('#type').change(function(){
		var value = $('#type').val();
		hidden(value);
	})
	
	$("#menuname").issNewMagnifier({
		title: '<%=MessageResourcesUtils.getMessage(request, "dailyoperation.menuauthoritymanage.menumagnifiertitle") %>',
		url: '${systemctx}/publicMagnifier/publicMagnifier.json',
		sortName : 'modifytime',
		sortOrder : 'desc',
		linkName: 'menuname',
		callSqlKey: 'queryMenuMagnifierSql',
		changeIgnore: ['menuname'],
		columns: [[
				{title:'<%=MessageResourcesUtils.getMessage(request, "dailyoperation.menuauthoritymanage.menuid") %>', field:'id', width:180, sortable:true, align: 'left',formel:'menuid'},
				{title:'<%=MessageResourcesUtils.getMessage(request, "dailyoperation.menuauthoritymanage.menuname") %>', field:'menuname', sortable:true, align: 'left', formel:'menuname'}
		]],
		onBeforeOpen:function(p){
	      var queryParams = {
	    		  querymenuname: '%' + $("#menuname").val() + '%'
	      };
	      return queryParams;
	    }
	});
	
	
	$('#butSave').click(function() {
			var exp = $('#form1').validationEngine('validate');
			if(exp==true)
			{
				$.ajax({
					type: 'POST',
				    url: '${systemctx}/dailyoperation/menuauthoritymanage/validattionMenuAuthorityManage.json',
				    data: $("#form1").serialize(),
				    dataType: 'json',
				    success: function(data)
				    {
				    	if (data.messagetype == '2')
				    	{
				    		//显示AJAX请求后的提示信息
							$.fn.ajaxmessage(data);
				    	}
				    	else
				    	{
				    		showSending();
				    		form1.action="${systemctx}/dailyoperation/menuauthoritymanage/doUpdateMenuAuthorityManage.web";
							form1.submit();
				    	}
				    }
				});
				
			}  
	});

	$('#butReturn').click(function(){
		parent.document.location.reload();
	    $.fn.closeIssWindow();
	});
	
});

function hidden(value){
	if(value !=1){
		$('#li_hidden').attr('hidden',false);
		
	}else{
		$('#li_hidden').attr('hidden',true);
		$('#menuname').val('');
		$('#menuid').val('');
	}
}
</script>
<%-- 引入页面尾 --%>
<%@ include file="/pageFloor.jsp"%>